]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Show a special error when screencast ran out of disk space
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 2 Oct 2023 12:00:45 +0000 (14:00 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Sun, 11 Feb 2024 10:32:19 +0000 (11:32 +0100)
Since we now propagate error types back to gnome-shell now, let's start
with showing a special error message in case the disk ran out of space,
which is probably the most typical error.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2976>

js/dbusServices/screencast/screencastService.js
js/misc/dbusErrors.js
js/ui/screenshot.js

index b87443e08d12749618e818e6e06e77db9dbd8c98..9a447942499ea655bf378a53a42fce85b5fc90b9 100644 (file)
@@ -363,9 +363,15 @@ class Recorder extends Signals.EventEmitter {
             case PipelineState.PLAYING:
             case PipelineState.FLUSHING: {
                 const [error] = message.parse_error();
-                this._handleFatalPipelineError(
-                    `GStreamer error while in state ${this._pipelineState}: ${error.message}`,
-                    ScreencastErrors, ScreencastError.PIPELINE_ERROR);
+
+                if (error.matches(Gst.ResourceError, Gst.ResourceError.NO_SPACE_LEFT)) {
+                    this._handleFatalPipelineError('Out of disk space',
+                        ScreencastErrors, ScreencastError.OUT_OF_DISK_SPACE);
+                } else {
+                    this._handleFatalPipelineError(
+                        `GStreamer error while in state ${this._pipelineState}: ${error.message}`,
+                        ScreencastErrors, ScreencastError.PIPELINE_ERROR);
+                }
 
                 break;
             }
index ff84f31402872cf961cb32f2439dbb677f87953c..6f4f80b51a42009eda9870afeff47d1adcb59163 100644 (file)
@@ -51,6 +51,7 @@ export const ScreencastError = {
     ALREADY_RECORDING: 3,
     RECORDER_ERROR: 4,
     SERVICE_CRASH: 5,
+    OUT_OF_DISK_SPACE: 6,
 };
 export const ScreencastErrors =
     registerErrorDomain('Screencast', ScreencastError);
index 7480f89dc5ef8f13c94667389d2fc0f74ca72050..fecc4584d822b7cf7306888beda008546d98aec5 100644 (file)
@@ -2039,7 +2039,14 @@ export const ScreenshotUI = GObject.registerClass({
             // Translators: notification title.
             this._showNotification(_('Screencast failed to start'));
             break;
+
         case ScreencastPhase.RECORDING:
+            if (error.matches(ScreencastErrors, ScreencastError.OUT_OF_DISK_SPACE)) {
+                // Translators: notification title.
+                this._showNotification(_('Screencast ended: Out of disk space'));
+                return;
+            }
+
             // Translators: notification title.
             this._showNotification(_('Screencast ended unexpectedly'));
             break;